/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.confiteriofuentes.modelo;


import com.confiteriafuentes.modelo.solicitud.DetallePedido;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;


public class DetallePedidoDAO implements IDAO<DetallePedido> {
      private Model model;
    private PreparedStatement psInsert;


    public DetallePedidoDAO() throws SQLException {
        model = Model.getInstance();
    }

    public void insert(DetallePedido t) throws SQLException {
        if (psInsert == null) {
            String sqlInsert = "INSERT INTO detalle_pedido (codigo_poductos, codigo_pedidos,cantidad,valor) VALUES (?,?,?,?)";
            psInsert = model.getCon().prepareStatement(sqlInsert);
        }
          psInsert.setInt(1,t.getProducto().getCodigo());
          psInsert.setInt(2, t.getPedido().getCodigo());
          psInsert.setInt(3,t.getCantidad());
          psInsert.setDouble(4,t.getValor());


        psInsert.executeUpdate();
    }







  


    public void delete(DetallePedido t) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public List<DetallePedido> getAll() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public DetallePedido find(Integer id) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void update(DetallePedido t) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

   
}
